package jz.sats.controller;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @Description: TODO
 * @Author: sats@jz
 * @Date: 2025/7/9 0:04
 **/
@RestController
@RequestMapping("/simple")
public class SimpleChatController {
    @Resource(name = "loveChatClient")
    private ChatClient loveChatClient;

    @RequestMapping(value = "/chat")
    public Flux<String> chat(@RequestParam("prompt") String prompt){
        return loveChatClient.prompt()
                .user(prompt)
                .stream()
                .content();
    }
}
